<template>
  <div>
    <!--
        确定框
        this.$confirm(提示的内容,'提示的标题',{
           确定按钮的文本(confirmButtonText),
           取消按钮的文本(cancelButtonText),
        }).then(()=>{点击了确定}).catch(()=>{点击了取消})
     -->
    <button @click="btnClick">弹出确定框</button>
  </div>
</template>
<script>
export default {
  created() {
    const arr = [
      { id: 1, name: '深圳', pid: '' },
      { id: 2, name: '宝安', pid: 1 },
      { id: 3, name: '石岩', pid: 2 },
      { id: 4, name: '南山', pid: 1 }
    ]
    const result = [
      {
        id: 1,
        name: '深圳',
        pid: '',
        children: [
          {
            id: 2,
            name: '宝安',
            pid: 1,
            children: [{ id: 3, name: '石岩', pid: 2 }]
          },
          { id: 4, name: '南山', pid: 1 }
        ]
      }
    ]
  },
  methods: {
    btnClick() {
      this.$confirm('您确定退出该网站吗?', '温馨提示', {
        confirmButtonText: '确定退出',
        cancelButtonText: '点错了'
      })
        .then(() => {
          // 点击了确定
          console.log('确定')
        })
        .catch(() => {
          // 点击了取消
          console.log('取消')
        })
    }
  }
}
</script>
<style></style>
